package com.how.diaryfriend.ui.home;

import android.app.Application;

import androidx.annotation.NonNull;
import androidx.lifecycle.AndroidViewModel;
import androidx.lifecycle.LiveData;

import com.how.diaryfriend.data.Diary;
import com.how.diaryfriend.data.DiaryRepository;

import java.util.List;


public class HomeViewModel extends AndroidViewModel {

    private DiaryRepository diaryRepository;

    public HomeViewModel(@NonNull Application application) {
        super(application);
        diaryRepository = new DiaryRepository(application);
    }

    LiveData<List<Diary>> getAllDiary() {
        return diaryRepository.getAllDiaryLive();
    }

    void insertDiarys(Diary... words) {
        diaryRepository.insertDiary(words);
    }

    void updateDiarys(Diary... words) {
        diaryRepository.updateDiary(words);
    }

    void deleteDiarys(Diary... words) {
        diaryRepository.deleteDiary(words);
    }

}